<!DOCTYPE html>

<html lang="zh-CN">
    <head>
    <meta charset="utf-8">
    <!--
        hexo-theme-suka © SukkaW
        GitHub: https://github.com/SukkaW/hexo-theme-suka
    -->

    <!-- ### Resource Hint ### -->

    <!-- ## DNS Prefetch ## -->
    <meta http-equiv="x-dns-prefetch-control" content="on">

<!-- busuanzi -->

    <link rel="dns-prefetch" href="//busuanzi.ibruce.info">


<!-- comment -->







<!-- analytics -->


    <link rel="dns-prefetch" href="//www.google-analytics.com">






    <!-- ## Preload ## -->
    
    <!-- Busuanzi -->
    
    <link rel="preload" href="https://cdn.jsdelivr.net/npm/busuanzi@2.3.0/bsz.pure.mini.js" as="script">







    <!-- ### Meta & Title & Info ### -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, maximum-scale=5, viewport-fit=cover">
    <meta name="renderer" content="webkit">

    <!-- Title -->
    <title>解决vscode在macos Catalina上配置C/C++环境及调试问题 | jxz4real の blog</title>

    <!-- Favicons -->
    <link rel="icon" type="image&#x2F;ico" href="/img/suka-favicon.ico">

    <!-- ### Import File ### -->
    <link rel="stylesheet" href="/lib/spectre/spectre.min.css"><style>
    body {
        background-color: #f8f9fa;
    }

    a, a:visited {
        color: #0070ff;
    }

    a:active, a:focus, a:hover {
        color: #0070ff;
        opacity: .75;
    }

    #post-content a,
    #post-content a:hover,
    #post-content a:focus,
    #post-content a:visited {
        color: #005eb9;
        opacity: 1;
    }

    

    .post-entry .card-body a {
        color: #0070ff;
    }

    .avatar {
        background: #444;
    }

    .navbar-link,
    .navbar-link:visited,
    .timeline .timeline-item .timeline-icon.icon-lg {
        color: #0070ff;
    }

    .navbar-link:hover {
        color: #0070ff;
        opacity: .8;
    }

    #search-input .btn,
    #disqus_click_btn,
    #disqus-switch-to-direct,
    #disqus-loadmore-button {
        background: #727e96;
        border-color: #727e96;
        color: #fff;
    }

    #post-toc a.post-toc-link,
    #post-toc a.post-toc-link:visited,
    .share-menu.menu .menu-item>a {
        color: #727e96;
    }

    .share-menu.menu .menu-item>a:hover,
    .share-menu.menu .menu-item>a:focus,
    .share-menu.menu .menu-item>a:visited {
        color: #50596c;
        background: #f8f9fa;
        opacity: .85;
    }
</style><link rel="stylesheet" href="/css/style.min.css">




    <!-- prism.css -->
    
    <link rel="preload" href="/lib/prism/prism-line-numbers.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/lib/prism/prism-line-numbers.min.css"></noscript><link rel="preload" href="/lib/prism/prism-default.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/lib/prism/prism-default.min.css"></noscript>









<script>
/*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
!function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){var e=t.media||"all";function a(){t.addEventListener?t.removeEventListener("load",a):t.attachEvent&&t.detachEvent("onload",a),t.setAttribute("onload",null),t.media=e}t.addEventListener?t.addEventListener("load",a):t.attachEvent&&t.attachEvent("onload",a),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(a,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this);
</script>

    <!-- ### Site Verification ### -->
    


    <meta name="mobile-web-app-capable" content="yes"><meta name="application-name" content="jxz4real の blog"><meta name="msapplication-starturl" content="http://yoursite.com"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-title" content="jxz4real の blog"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">

    <!-- ### The Open Graph & Twitter Card Protocol ### -->
    <meta property="og:title" content="解决vscode在macos Catalina上配置C&#x2F;C++环境及调试问题 | jxz4real の blog"><meta property="og:site_name" content="jxz4real の blog"><meta property="og:type" content="article"><meta property="og:url" content="http://yoursite.com/2020/02/28/vscode-C-macOS-catalina/"><meta property="og:locale" content="zh-CN"><meta name="description" content="本文作者对编译调试的原理一窍不通，只是在完完全全按照知乎及其他网站上的vscode配置C的launch.json&amp;amp;tasks.json&amp;amp;c_cpp_properties.json之后，编译正常，但是无法debug。经数小时的修改，搜索找到了解决方案，从头至尾记录一下。 - jxz4real - jxz4real の blog"><meta name="keywords" content="-vscode"><meta property="og:image" content="https://ftp.bmp.ovh/imgs/2020/02/7bc248a955d5f4fc.jpg"><meta property="og:image" content="https://ftp.bmp.ovh/imgs/2020/02/cd8dc81a42757164.jpg"><meta property="og:image" content="https://ftp.bmp.ovh/imgs/2020/02/624398c653580021.png"><meta property="og:image" content="https://ftp.bmp.ovh/imgs/2020/02/9e6c7d5ec9528874.jpg"><meta property="og:image" content="https://ftp.bmp.ovh/imgs/2020/02/87012422472c071d.jpg"><meta property="article:published_time" content="2020-02-28T09:16:19.000Z"><meta property="article:modified_time" content="2020-02-28T10:06:09.840Z"><meta property="og:updated_time" content="2020-02-28T10:06:09.840Z"><meta property="article:author" content="jxz4real"><meta property="article:tag" content="-vscode"><meta name="twitter:card" content="summary">

    

    <!-- ### Canonical link ### -->
    <link rel="canonical" href="http://yoursite.com/2020/02/28/vscode-C-macOS-catalina/">

    <meta name="generator" content="Hexo 4.2.0">

    <!-- ### Analytics ### -->
    
    <!-- Google Analytics -->
<script>
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    ga('create', 'UA-159326044-1', 'auto');
    ga('send', 'pageview');
</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>









    <!-- ### Structured Data ### -->
    



<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "url": "http://yoursite.com/2020/02/28/vscode-C-macOS-catalina/",
    "@type": "BlogPosting",
    "logo": "http://yoursite.com/img/suka-favicon.ico",
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "http://yoursite.com/2020/02/28/vscode-C-macOS-catalina/"
    },
    "headline": "解决vscode在macos Catalina上配置C/C++环境及调试问题 | jxz4real の blog",
    
    "image": {
        "@type": "ImageObject",
        "url": "http://yoursite.com/img/suka-favicon.ico"
    },
    
    "datePublished": "2020-02-28T09:16:19.000Z",
    "dateModified": "2020-02-28T10:06:09.840Z",
    "author": {
        "@type": "Person",
        "name": "jxz4real",
        "image": {
            "@type": "ImageObject",
            "url": "http://yoursite.com/img/IMG_20190617_175609.JPG"
        },
        "description": "Perfection is the enemy of done."
    },
    "publisher": {
        "@type": "Organization",
        "name": "jxz4real の blog",
        "logo": {
            "@type": "ImageObject",
            "url": "http://yoursite.com/img/suka-favicon.ico"
        }
    },
    
    "potentialAction": {
        "@type": "SearchAction",
        "target": "http://yoursite.com/search.html?s={search_term_string}",
        "query-input": "required name=search_term_string"
    },
    
    "keywords": "-vscode",
    "description": "本文作者对编译调试的原理一窍不通，只是在完完全全按照知乎及其他网站上的vscode配置C的launch.json&amp;amp;amp;tasks.json&amp;amp;amp;c_cpp_properties.json之后，编译正常，但是无法debug。经数小时的修改，搜索找到了解决方案，从头至尾记录一下。 - jxz4real - jxz4real の blog"
}
</script>



    <!-- ### Custom Head ### -->
    
</head>

    <body>
            

            <!-- ### Main content ### -->
            <!-- ## Header ##-->
<header>
    <h1 class="header-title text-center"><a href="/">jxz4real の blog</a></h1>

    <p class="text-center header-slogan">
        
            
                Perfection is the enemy of done.
            
        
    </p>

    <nav class="navbar-section text-center">
    
        <a href="/" class="navbar-link">首页</a>
    
    
        <a href="/archives/" class="navbar-link">归档</a>
    
    
        <a href="/search.html" class="navbar-link">搜索</a>
    
    
        <a href="/index.html" class="navbar-link">分类</a>
    
    
    
</nav>
</header>

            
    <!-- ## Post ## -->
    <div class="post-container">
    <div id="post-card" class="card">
        
        <div class="card-item-container">
            <div class="card-inner-cell">
                <!-- # Post Header Info # -->
                <div class="card-header">
                    
    <h1 class="card-title h3 mb-2">解决vscode在macos Catalina上配置C/C++环境及调试问题</h1>




<div class="post-header-info">
    <p class="post-header-info-left text-gray">
        <img class="author-thumb lazyload" data-src="/img/IMG_20190617_175609.JPG" src="/img/suka-lazyload.gif" alt="jxz4real's Avatar">
        <span>2020-02-28</span>
        
            <span class="suka-devide-dot"></span>
            <a class="category-link" href="/categories/%E9%85%8D%E7%BD%AE/">配置</a>
        
        
            <!-- Busuanzi Post Views -->
<span id="busuanzi_container_page_pv" hidden>
    <span class="suka-devide-dot"></span>
    <span></span>
    <span id="busuanzi_value_page_pv"></span>
    <span>Views</span>
</span>
        
        
    </p>
    <div class="post-header-info-right">
        
            <div class="dropdown dropdown-right">
<a class="dropdown-toggle" tabindex="0">分享本文</a>
<ul class="menu share-menu">
    <!-- Share Weibo -->
    
    <li class="menu-item">
        <a href="http://service.weibo.com/share/share.php?appkey=&title=解决vscode在macos Catalina上配置C/C++环境及调试问题&url=http://yoursite.com/2020/02/28/vscode-C-macOS-catalina/&pic=http://yoursite.com/img/suka-favicon.ico&searchPic=false&style=simple" target="_blank" rel="external noopener noreferrer nofollow">分享到微博</a>
    </li>
    

    <!-- Share Twitter -->
    

    <!-- Share Facebook -->
    

    <!-- Share Google+ -->
    

    <!-- Share LinkedIn -->
    

    <!-- Share QQ -->
    
    <li class="menu-item">
        <a href="http://connect.qq.com/widget/shareqq/index.html?site=jxz4real の blog&title=jxz4real の blog&summary=爷的秋秋空间&pics=http://yoursite.com/img/suka-favicon.ico&url=http://yoursite.com/2020/02/28/vscode-C-macOS-catalina/" target="_blank" rel="external noopener noreferrer nofollow"> 分享到 QQ</a>
    </li>
    

    <!-- Share Telegram -->
    

    <!-- QRCode -->
    
    <li class="menu-item">
        <img src="" alt="QRCode">
    </li>
    

</ul>
</div>
        
    </div>
</div>
                </div>
                <div class="card-body">
                    
                        
                        
                    
                    <article id="post-content">
                        <p>本文作者对编译调试的原理一窍不通，只是在完完全全按照知乎及其他网站上的vscode配置C的launch.json&amp;tasks.json&amp;c_cpp_properties.json之后，编译正常，但是无法debug。经数小时的修改，搜索找到了解决方案，从头至尾记录一下。</p>
<a id="more"></a>
<p>网上有关在Mac上配置vscode的文章有很多，相信找到这篇文章的人已经阅读过相关文章，这篇文章与很多配置教程的区别就是解决了调试代码时的报错： Warning: Debuggee TargetArchitecture not detected, assuming x86_64. 众所周知，调试有gdb/lldb可选，Mac的小伙伴一般都选用lldb，而出现这个错误大概就是因为Catalina不再支持lldb调试吧。可参考：<a href="https://github.com/microsoft/vscode-cpptools/issues/3829" target="_blank" rel="noopener">官方文档解释</a>。</p>
<p>s1：下载vscode并安装</p>
<p>s2: 安装插件：C/C++（提供环境还有intelliSence），Code Runner（用来编译，很方便），CodeLLDB（用来debug，解决Catalina不支持lldb调试问题）</p>
<p><img src="https://ftp.bmp.ovh/imgs/2020/02/7bc248a955d5f4fc.jpg" alt="pic.1"></p>
<p>s3：创建.json文档</p>
<p><img src="https://ftp.bmp.ovh/imgs/2020/02/cd8dc81a42757164.jpg" alt="pic.2"></p>
<p>vscode的逻辑是你可以创造很多工作区，每个工作区可以有不同的配置。每个工作区下当然要有项目文件夹，所以第一步就是创造工作区和项目文件夹，我们把C和C++的工作区分开，我们以创建C的工作区为例，C++工作区的话你改个名字就行，而两个工作区的json也基本一样，不一样的地方在后文标注了（只有两处）：在桌面建立一个vscode-c文件夹，打开vscode之后，点击该图左侧边栏第一个图标，选择open folder，选择vscode-c。（达到上述结果有很多方法，怎么都行）</p>
<p><img src="https://ftp.bmp.ovh/imgs/2020/02/624398c653580021.png" alt="pic.3"></p>
<p>点击file-save workspace as，然后给工作区起名为C，直接保存就行，会创建一个C.code-workspace文件。（以后打开该项目就可以点击这个文件）</p>
<p><img src="https://ftp.bmp.ovh/imgs/2020/02/9e6c7d5ec9528874.jpg" alt="pic.4"></p>
<p>在vscode-c文件夹中创建名为.vscode的文件夹（这是一个隐藏文件夹），在该文件夹中创建如图4中的那几个.json文件（忽略那个text.out.DSYM），然后把下面的代码复制到相应文件中（以下代码为从网上各处搜集）</p>
<p>1 launch.json(粘贴后会有几处波浪线，应该是codeLLDB插件的缘故，但是不影响debug使用，可以不用删)</p>
<pre><code>// https://github.com/Microsoft/vscode-cpptools/blob/master/launch.md
{
    &quot;version&quot;: &quot;0.2.0&quot;,
    &quot;configurations&quot;: [
        {
            &quot;name&quot;: &quot;c Launch&quot;, // 配置名称，将会在启动配置的下拉菜单中显示
            &quot;type&quot;: &quot;lldb&quot;, // 配置类型，cppdbg对应cpptools提供的调试功能；可以认为此处只能是cppdbg
            &quot;request&quot;: &quot;launch&quot;, // 请求配置类型，可以为launch（启动）或attach（附加）
            &quot;program&quot;: &quot;${fileDirname}/${fileBasenameNoExtension}.out&quot;, // 将要进行调试的程序的路径
            //&quot;program&quot;: &quot;${workspaceFolder}/${fileBasenameNoExtension}.out&quot;,
            &quot;args&quot;: [
                &quot;-arg1&quot;,
                &quot;-arg2&quot;
            ], // 程序调试时传递给程序的命令行参数，一般设为空即可
            &quot;stopAtEntry&quot;: false, // 设为true时程序将暂停在程序入口处，相当于在main上打断点
            &quot;cwd&quot;: &quot;${workspaceFolder}&quot;, // 调试程序时的工作目录，此为工作区文件夹；改成${fileDirname}可变为文件所在目录
            &quot;environment&quot;: [], // 环境变量
            &quot;externalConsole&quot;: true, // 为true时使用单独的cmd窗口，与其它IDE一致；18年10月后设为false可调用VSC内置终端
            &quot;internalConsoleOptions&quot;: &quot;neverOpen&quot;, // 如果不设为neverOpen，调试时会跳到“调试控制台”选项卡，你应该不需要对gdb手动输命令吧？
            &quot;MIMode&quot;: &quot;lldb&quot;, // 指定连接的调试器，可以为gdb或lldb。但我没试过lldb
            //&quot;miDebuggerPath&quot;: &quot;gdb.exe&quot;, // 调试器路径，Windows下后缀不能省略，Linux下则不要
            /*&quot;setupCommands&quot;: [
            { // 模板自带，好像可以更好地显示STL容器的内容，具体作用自行Google
                &quot;description&quot;: &quot;Enable pretty-printing for gdb&quot;,
                &quot;text&quot;: &quot;-enable-pretty-printing&quot;,
                &quot;ignoreFailures&quot;: false
            }
        ],*/
            &quot;preLaunchTask&quot;: &quot;Compile&quot;, // 调试会话开始前执行的任务，一般为编译程序。与tasks.json的label相对应
        }
    ]
}</code></pre><p>2 tasks.json（要编译c++把command：改为clang++，可能不改也行吧？把args的”-std=c11”改为”-std=c++17”）</p>
<pre><code>// https://code.visualstudio.com/docs/editor/tasks
{
    &quot;version&quot;: &quot;2.0.0&quot;,
    &quot;tasks&quot;: [{
        &quot;label&quot;: &quot;Compile&quot;, // 任务名称，与launch.json的preLaunchTask相对应
        &quot;command&quot;: &quot;clang&quot;,   // 要使用的编译器，C++用g++
        &quot;args&quot;: [
            //&quot;-g&quot;,    // 生成和调试有关的信息
            &quot;${file}&quot;,
            &quot;-std=c11&quot;, 
            &quot;-stdlib=libc++&quot;,
            &quot;-o&quot;,    // 指定输出文件名，不加该参数则默认输出a.exe，Linux下默认a.out
            &quot;${fileDirname}/${fileBasenameNoExtension}.out&quot;,
            &quot;--debug&quot;

            //&quot;-Wall&quot;, // 开启额外警告
            //&quot;-static-libgcc&quot;,     // 静态链接libgcc，一般都会加上
            //&quot;-fexec-charset=GBK&quot;, // 生成的程序使用GBK编码，不加这一条会导致Win下输出中文乱码
            // C++最新标准为c++17，或根据自己的需要进行修改
        ], // 编译的命令，其实相当于VSC帮你在终端中输了这些东西
        &quot;type&quot;: &quot;shell&quot;, // process是vsc把预定义变量和转义解析后直接全部传给command；shell相当于先打开shell再输入命令，所以args还会经过shell再解析一遍
        &quot;group&quot;: {
            &quot;kind&quot;: &quot;build&quot;,
            &quot;isDefault&quot;: true // 不为true时ctrl shift B就要手动选择了
        },
        &quot;presentation&quot;: {
            &quot;echo&quot;: true,  
            &quot;reveal&quot;: &quot;always&quot;, // 执行任务时是否跳转到终端面板，可以为always，silent，never。具体参见VSC的文档
            &quot;focus&quot;: false,     // 设为true后可以使执行task时焦点聚集在终端，但对编译C/C++来说，设为true没有意义
            &quot;panel&quot;: &quot;shared&quot;   // 不同的文件的编译信息共享一个终端面板
        },
        // &quot;problemMatcher&quot;:&quot;$gcc&quot; // 此选项可以捕捉编译时终端里的报错信息；但因为有Lint，再开这个可能有双重报错

    }]
}</code></pre><p>3 c_cpp_properties.json</p>
<pre><code>{
    &quot;configurations&quot;: [
        {
            &quot;name&quot;: &quot;Mac&quot;,
            &quot;includePath&quot;: [
                &quot;${workspaceFolder}/**&quot;,
                &quot;/Library/Developer/CommandLineTools/usr/include/c++/v1&quot;,
                &quot;/usr/local/include&quot;,
                &quot;/Library/Developer/CommandLineTools/usr/lib/clang/9.0.0/include&quot;,
                &quot;/Library/Developer/CommandLineTools/usr/include&quot;,
                &quot;/usr/include&quot;
            ],
            &quot;defines&quot;: [],
            &quot;macFrameworkPath&quot;: [
                &quot;/System/Library/Frameworks&quot;,
                &quot;/Library/Frameworks&quot;
            ],
            &quot;compilerPath&quot;: &quot;/usr/bin/clang&quot;,
            &quot;cStandard&quot;: &quot;c11&quot;,
            &quot;cppStandard&quot;: &quot;c++17&quot;,
            &quot;intelliSenseMode&quot;: &quot;${default}&quot;
        }
    ],
    &quot;version&quot;: 4
}</code></pre><p>4 settings.json</p>
<pre><code>//只在当前工作区有效

{
    &quot;files.defaultLanguage&quot;: &quot;c&quot;, // ctrl+N新建文件后默认的语言
    &quot;editor.formatOnType&quot;: true,  // 输入分号(C/C++的语句结束标识)后自动格式化当前这一行的代码
    &quot;editor.suggest.snippetsPreventQuickSuggestions&quot;: false, // clangd的snippets有很多的跳转点，不用这个就必须手动触发Intellisense了
    &quot;editor.acceptSuggestionOnEnter&quot;: &quot;off&quot;, // 我个人的习惯，按回车时一定是真正的换行，只有tab才会接受Intellisense
    // &quot;editor.snippetSuggestions&quot;: &quot;top&quot;, // （可选）snippets显示在补全列表顶端，默认是inline

    &quot;code-runner.runInTerminal&quot;: true, // 设置成false会在“输出”中输出，无法输入
    /*&quot;code-runner.executorMap&quot;: {
        &quot;c&quot;: &quot;cd $dir &amp;&amp; gcc &#39;$fileName&#39; -o &#39;$fileNameWithoutExt.exe&#39; -Wall -g -O2 -static-libgcc -std=c11 -fexec-charset=GBK &amp;&amp; &amp;&#39;$dir$fileNameWithoutExt&#39;&quot;,
        &quot;cpp&quot;: &quot;cd $dir &amp;&amp; g++ &#39;$fileName&#39; -o &#39;$fileNameWithoutExt.exe&#39; -Wall -g -O2 -static-libgcc -std=c++17 -fexec-charset=GBK &amp;&amp; &amp;&#39;$dir$fileNameWithoutExt&#39;&quot;
        // &quot;c&quot;: &quot;cd $dir &amp;&amp; gcc $fileName -o $fileNameWithoutExt.exe -Wall -g -O2 -static-libgcc -std=c11 -fexec-charset=GBK &amp;&amp; $dir$fileNameWithoutExt&quot;,
        // &quot;cpp&quot;: &quot;cd $dir &amp;&amp; g++ $fileName -o $fileNameWithoutExt.exe -Wall -g -O2 -static-libgcc -std=c++17 -fexec-charset=GBK &amp;&amp; $dir$fileNameWithoutExt&quot;
    }, // 右键run code时运行的命令；未注释的仅适用于PowerShell（Win10默认），文件名中有空格也可以编译运行；注释掉的适用于cmd（win7默认），PS和bash也能用，但文件名中有空格时无法运行*/
    &quot;code-runner.saveFileBeforeRun&quot;: true, // run code前保存
    &quot;code-runner.preserveFocus&quot;: true,     // 若为false，run code后光标会聚焦到终端上。如果需要频繁输入数据可设为false
    &quot;code-runner.clearPreviousOutput&quot;: false, // 每次run code前清空属于code runner的终端消息，默认false
    &quot;code-runner.ignoreSelection&quot;: true,   // 默认为false，效果是鼠标选中一块代码后可以单独执行，但C是编译型语言，不适合这样用

    &quot;C_Cpp.clang_format_sortIncludes&quot;: true, // 格式化时调整include的顺序（按字母排序）
}</code></pre><p>以上代码有很多我注释掉的部分，原因是有些配置文件是从windows的教程扒下来的，有些Mac上用不了，被我注释了。。。</p>
<p>然后就可以编译加调试了，但像我一样的小白肯定一头雾水，如果你想大致了解这些东西都是干什么的参见以下前俩个链接；解决debug问题的原文链接（该作者也可能是转载）是第三个：</p>
<ul>
<li><p><a href="https://www.zhihu.com/question/30315894/answer/154979413/" target="_blank" rel="noopener"win版的但他讲的很细，可以照猫画虎"">Visual Studio Code 如何编写运行 C、C++ 程序？</a></p>
</li>
<li><p><a href="https://zhuanlan.zhihu.com/p/48233069/" target="_blank" rel="noopener"Mac版，但2020.2.14按步骤后debug不能用"">玄魂：无废话–Mac OS, VS Code 搭建c/c++基本开发环境</a></p>
</li>
<li><p><a href="https://link.zhihu.com/?target=https%3A//www.jianshu.com/p/965123aae9b9">debug解决方法出处</a></p>
</li>
</ul>
<p><img src="https://ftp.bmp.ovh/imgs/2020/02/87012422472c071d.jpg" alt="确实能debug"></p>

                    </article>
                    
    <blockquote class="post-license">
        <p>
            <strong>本文作者&nbsp;:&nbsp;jxz4real</strong>
            <br>
            <strong>
            
                本文使用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)</a> 协议
            </strong>
            <br>
            <strong>本文链接&nbsp;:&nbsp;</strong><a href="http://yoursite.com/2020/02/28/vscode-C-macOS-catalina/">http://yoursite.com/2020/02/28/vscode-C-macOS-catalina/</a>
        </p>
    </blockquote>



    <blockquote id="date-expire-notification" class="post-expired-notify">本文最后更新于 <span id="date-expire-num"></span> 天前，文中所描述的信息可能已发生改变</blockquote>
    <script>
    (function() {
        var dateUpdate = Date.parse("2020-02-28");
        var nowDate = new Date();
        var a = nowDate.getTime();
        var b = a - dateUpdate;
        var daysUpdateExpire = Math.floor(b/(24*3600*1000));
        if (daysUpdateExpire >= 120) {
            document.getElementById('date-expire-num').innerHTML = daysUpdateExpire;
        } else {
            document.getElementById('date-expire-notification').style.display = 'none';
        }
    })();
    </script>


<p class="post-footer-info mb-0 pt-0">本文发表于&nbsp;<time datetime="2020-02-28T09:16:19.000Z" itemprop="datePublished">2020-02-28</time>

</p>
<p class="post-footer-info mb-0 pt-2">

<span class="post-categories-list mt-2">

<a class="post-categories-list-item" href='/categories/%E9%85%8D%E7%BD%AE/'>配置</a>

</span>



<span class="post-tags-list mt-2">

<a class="post-tags-list-item" href="/tags/vscode/" rel="tag">#&nbsp;-vscode</a>

</span>


</p>

                </div>
                <div class="post-nav px-2 bg-gray">
<ul class="pagination">
    <!-- Prev Nav -->
    

    <!-- Next Nav -->
    
        <li class="page-item page-next">
            <a href="/2020/02/27/hello-world/" rel="next">
                <div class="page-item-title"><i class="icon icon-forward" aria-hidden="true"></i></div>
                <div class="page-item-subtitle">Hello World</div>
            </a>
        </li>
    
</ul>
</div>

                
                    <!-- # Comment # -->
                    
                
            </div>
        </div>
    </div>
</div>

            <!-- ### Footer ### -->
            <footer class="text-center">
    <!-- footer copyright -->
    
        <p class="footer-copyright mb-0">Copyright&nbsp;©&nbsp;<span id="copyright-year"></span>
            <a class="footer-copyright-a" href="http://yoursite.com">jxz4real の blog</a>
        </p>

    <!-- footer custom text -->
    <p class="footer-text mb-0">
    
    </p>
    <!-- footer develop info -->
    <p class="footer-develop mb-0">
        
    <!-- Busuanzi User Views -->
    <span id="busuanzi_container_site_uv" hidden>
        <span></span>
        <span id="busuanzi_value_site_uv"></span>
        <span>Viewers</span>
        
            <span>|</span>
        
    </span>




        
        Powered by&nbsp;<!--
         --><a href="https://hexo.io" target="_blank" class="footer-develop-a" rel="external nofollow noopener noreferrer">Hexo</a><span class="footer-develop-divider"></span>Theme&nbsp;-&nbsp;<!--
         --><a href="https://github.com/SukkaW/hexo-theme-suka" target="_blank" class="footer-develop-a" rel="external noopener">Suka</a>
    </p>
</footer>


        <!-- ### Import File ### -->
        <!-- ### Footer JS Import ### -->

<script>

    
window.lazyLoadOptions = {
    elements_selector: ".lazyload",
    threshold: 50
};

(function() {
    var copyrightNow = new Date().getFullYear();
    var copyrightContent = document.getElementById('copyright-year');
    var copyrightSince = 2020;
    if (copyrightSince === copyrightNow) {
        copyrightContent.textContent = copyrightNow;
    } else {
        copyrightContent.textContent = copyrightSince + ' - ' + copyrightNow;
    }
})();
console.log('\n %c Suka Theme (hexo-theme-suka) | © SukkaW | Verision 1.3.3 %c https://github.com/SukkaW/hexo-theme-suka \n', 'color: #fff; background: #444; padding:5px 0;', 'background: #bbb; padding:5px 0;');

</script>

<script src="/lib/vanilla-lazyload/lazyload.min.js" async></script>
    <script src="https://cdn.jsdelivr.net/npm/busuanzi@2.3.0/bsz.pure.mini.js" async></script>


<!-- Offset -->




<!-- Comment -->


<!-- ### Custom Footer ### -->

    </body>

</html>